import request from '@/utils/request'
import type { goodsListItemType } from '@/api/goodslist/interface'
enum Api {
  getGoodsList = 'xhr/item/listByCategory.json',
}

export const reqGoodsListApi = (data: goodsListItemType) => {
  return request.get<any, any>(Api.getGoodsList, {
    params: {
      __timestamp: window.Date.now(),
      sortType: data.sortType || '0',
      descSorted: data.descSorted || 'false',
      deliveryAreaId: data.deliveryAreaId || '0',
      subCategoryId: data.subCategoryId || '0',
      categoryId: data.categoryId
    }
  })
}